require.config({
               baseUrl:"../",
               paths:{
               bsl:'bsl',
               
               }
               });
require(['bsl'],function(bsl){
        document.addEventListener('deviceready', onDeviceready, false);
        
        
        function onDeviceready(){
        alert("star");
        var Fullscreen = false;
        function setFullscreen(){
            if(Fullscreen){
                Fullscreen = false;
            }
            else{
                Fullscreen = true;
            }
            
            bsl.navigator.setFullscreen(Fullscreen);
        }
        
        function setStatusBarBackground()
        {
        var rgb = "#009FCC";
        bsl.navigator.setStatusBarBackground(rgb);
        }
        
        function setStatusBarStyle()
        {
        var style = "UIStatusBarStyleDefault";
        bsl.navigator.setStatusBarStyle(style);

        }
        
        function isFullscreen()
        {
        bsl.navigator.isFullscreen(onSuccess);

        }
        
        function onSuccess(Boolean)
        {
        var fullscreens = Boolean ? "是":"否";
        document.getElementById('navigator').innerHTML= '是否全屏显示:' + fullscreens;
        }
        
        function getStatusBarStyle()
        {
        bsl.navigator.getStatusBarStyle(onSuccess1);
        }
        
        function onSuccess1(style)
        {
        document.getElementById('navigator').innerHTML= '状态栏样式:' + style;

        }
        
        function getStatusBarBackground()
        {
        bsl.navigator.getStatusBarBackground(onSuccess2)
        }
        
        function onSuccess2(rgb)
        {
        document.getElementById('navigator').innerHTML= '状态栏背景颜色:' + rgb;

        }
//        
        function setCookie()
        {
        var url = "baidu.com";
        var value = "rainbird";
        bsl.navigator.setCookie(url,value);
        }
        
        function getCookie()
        {
        var url = "baidu.com";
        bsl.navigator.getCookie(onSuccess3,url);
        }
        
        function onSuccess3(cookie)
        {
        document.getElementById('navigator').innerHTML= 'cookie值:' + cookie;
        }
        
        function removeAllCookie ()
        {
        bsl.navigator.removeAllCookie();
        }
        
        function removeCookie()
        {
        var url = "baidu.com";
        bsl.navigator.removeCookie(url);
        }
        
        function removeSessionCookie()
        {
        bsl.navigator.removeSessionCookie();
        }
        
        
        document.getElementById("setFullscreen").addEventListener("click",setFullscreen,false);
        document.getElementById("setStatusBarBackground").addEventListener("click",setStatusBarBackground,false);
            document.getElementById("setStatusBarStyle").addEventListener("click",setStatusBarStyle,false);
            document.getElementById("isFullscreen").addEventListener("click",isFullscreen,false);
            document.getElementById("getStatusBarStyle").addEventListener("click",getStatusBarStyle,false);
            document.getElementById("getStatusBarBackground").addEventListener("click",getStatusBarBackground,false);
        

        document.getElementById("setCookie").addEventListener("click",setCookie,false);
        document.getElementById("getCookie").addEventListener("click",getCookie,false);
        document.getElementById("removeAllCookie").addEventListener("click",removeAllCookie,false);

        document.getElementById("removeCookie").addEventListener("click",removeCookie,false);
        document.getElementById("removeSessionCookie").addEventListener("click",removeSessionCookie,false);

        }
        
        
        });

